Nibble (computing)
   HOME

TheInfoList



OR:

In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, e ...
, a nibble (occasionally nybble, nyble, or nybl to match the spelling of
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
) is a four-
bit The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represente ...
aggregation, or half an
octet Octet may refer to: Music * Octet (music), ensemble consisting of eight instruments or voices, or composition written for such an ensemble ** String octet, a piece of music written for eight string instruments *** Octet (Mendelssohn), 1825 compos ...
. It is also known as half-byte or tetrade. In a networking or
telecommunication Telecommunication is the transmission of information by various types of technologies over wire, radio, optical, or other electromagnetic systems. It has its origin in the desire of humans for communication over a distance greater than that fe ...
context, the nibble is often called a semi-octet, quadbit, or quartet. A nibble has sixteen () possible values. A nibble can be represented by a single
hexadecimal In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, hexa ...
digit (–) and called a hex digit. A full
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
(octet) is represented by two hexadecimal digits (–); therefore, it is common to display a byte of information as two nibbles. Sometimes the set of all 256-byte values is represented as a table, which gives easily readable hexadecimal codes for each value.
Four-bit In computer architecture, 4-bit integers, or other data units are those that are 4 bits wide. Also, 4-bit central processing unit (CPU) and arithmetic logic unit (ALU) architectures are those that are based on registers, or data buses of that s ...
computer architecture In computer engineering, computer architecture is a description of the structure of a computer system made from component parts. It can sometimes be a high-level description that ignores details of the implementation. At a more detailed level, t ...
s use groups of four bits as their fundamental unit. Such architectures were used in early
microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit, or a small number of integrated circuits. The microprocessor contains the arithmetic, logic, and control circu ...
s,
pocket calculator An electronic calculator is typically a portable electronic device used to perform calculations, ranging from basic arithmetic to complex mathematics. The first solid-state electronic calculator was created in the early 1960s. Pocket-sized d ...
s and
pocket computer A pocket computer was a 1980s-era user programmable calculator-sized computer that had fewer screen lines, Some had only one line and often fewer characters per line, than the Pocket-sized computers introduced beginning in 1989. Manufacturers in ...
s. They continue to be used in some
microcontroller A microcontroller (MCU for ''microcontroller unit'', often also MC, UC, or μC) is a small computer on a single VLSI integrated circuit (IC) chip. A microcontroller contains one or more CPUs (processor cores) along with memory and programmable i ...
s. In this context, 4-bit groups were sometimes also called ''
character Character or Characters may refer to: Arts, entertainment, and media Literature * ''Character'' (novel), a 1936 Dutch novel by Ferdinand Bordewijk * ''Characters'' (Theophrastus), a classical Greek set of character sketches attributed to The ...
s'' rather than nibbles.


History

The term ''nibble'' originates from its representing "half a byte", with ''byte'' a
homophone A homophone () is a word that is pronounced the same (to varying extent) as another word but differs in meaning. A ''homophone'' may also differ in spelling. The two words may be spelled the same, for example ''rose'' (flower) and ''rose'' (p ...
of the
English English usually refers to: * English language * English people English may also refer to: Peoples, culture, and language * ''English'', an adjective for something of, from, or related to England ** English national ide ...
word ''bite''. In 2014, David B. Benson, a professor emeritus at
Washington State University Washington State University (Washington State, WSU, or informally Wazzu) is a public land-grant research university with its flagship, and oldest, campus in Pullman, Washington. Founded in 1890, WSU is also one of the oldest land-grant unive ...
, remembered that he playfully used (and may have possibly coined) the term ''nibble'' as "half a byte" and unit of storage required to hold a
binary-coded decimal In computing and electronic systems, binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits, usually four or eight. Sometimes, special bit patterns are used for ...
(BCD) decimal digit around 1958, when talking to a programmer of
Los Alamos Scientific Laboratory Los Alamos National Laboratory (often shortened as Los Alamos and LANL) is one of the sixteen research and development laboratories of the United States Department of Energy (DOE), located a short distance northwest of Santa Fe, New Mexico, in ...
. The alternative spelling ''nybble'' reflects the spelling of ''byte'', as noted in editorials of '' Kilobaud'' and ''
Byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
'' in the early 1980s. Another early recorded use of the term ''nybble'' was in 1977 within the consumer-banking technology group at Citibank. It created a pre-
ISO 8583 ISO 8583 is an international standard for ''financial transaction card originated'' interchange messaging. It is the International Organization for Standardization standard for systems that exchange electronic transactions initiated by cardholde ...
standard for transactional messages between
cash machines An automated teller machine (ATM) or cash machine (in British English) is an electronic telecommunications device that enables customers of financial institutions to perform financial transactions, such as cash withdrawals, deposits, fund ...
and Citibank's
data center A data center (American English) or data centre (British English)See spelling differences. is a building, a dedicated space within a building, or a group of buildings used to house computer systems and associated components, such as telecommunic ...
s that used the basic informational unit 'NABBLE'. The nibble is used to describe the amount of memory used to store a digit of a number stored in packed decimal format (BCD) within an IBM mainframe. This technique is used to make computations faster and debugging easier. An 8-bit byte is split in half and each nibble is used to store one decimal digit. The last (rightmost) nibble of the variable is reserved for the sign. Thus a variable which can store up to nine digits would be "packed" into 5 bytes. Ease of debugging resulted from the numbers being readable in a
hex dump In computing, a hex dump is a hexadecimal view (on screen or paper) of computer data, from memory or from a computer file or storage device. Looking at a hex dump of data is usually done in the context of either debugging, reverse engineering or ...
where two hex numbers are used to represent the value of a byte, as . For example, a five-byte BCD value of      represents a decimal value of . Historically, there are cases where nybble was used for a group of bits greater than 4. In the Apple II microcomputer line, much of the disk drive control and group-coded recording was implemented in software. Writing data to a disk was done by converting 256-byte pages into sets of 5-bit (later, 6-bit) nibbles and loading disk data required the reverse. Moreover, 1982 documentation for the
Integrated Woz Machine The Integrated Woz Machine (or IWM for short) is a single-chip version of the floppy disk controller for the Apple II. It was also employed in Macintosh computers. History When developing a floppy drive for the Apple II, Apple Inc. co-founde ...
refers consistently to an "8 bit nibble". The term ''byte'' once had the same ambiguity and meant a set of bits but not necessarily 8, hence the distinction of ''bytes'' and ''
octet Octet may refer to: Music * Octet (music), ensemble consisting of eight instruments or voices, or composition written for such an ensemble ** String octet, a piece of music written for eight string instruments *** Octet (Mendelssohn), 1825 compos ...
s'' or of ''nibbles'' and ''quartets'' (or ''quadbits''). Today, the terms ''byte'' and ''nibble'' almost always refer to 8-bit and 4-bit collections respectively and are very rarely used to express any other sizes.


Table of nibbles

The sixteen nibbles and their equivalents in other numeral systems:


Low and high nibbles

The terms ''low nibble'' and ''high nibble'' are used to denote the nibbles containing, respectively, the less significant bits and the more significant bits within a byte. In graphical representations of bits within a byte, the leftmost bit could represent the most significant bit ( MSB), corresponding to ordinary decimal notation in which the digit at the left of a number is the most significant. In such illustrations the four bits on the left end of the byte form the high nibble, and the remaining four bits form the low nibble. For example, the high nibble is (), and the low nibble is (). The total value is ().


Extracting a nibble from a byte

A nibble can be extracted from a byte by doing a bitwise logical AND operation and optionally a
bit shift In computer programming, a bitwise operation operates on a bit string, a bit array or a binary numeral (considered as a bit string) at the level of its individual bits. It is a fast and simple action, basic to the higher-level arithmetic operati ...
depending on if the high or low nibble is to be extracted. In C: #define HI_NIBBLE(b) (((b) >> 4) & 0x0F) #define LO_NIBBLE(b) ((b) & 0x0F) where b must be a variable or constant of an
integral data type In computer science, an integer is a datum of integral data type, a data type that represents some range of mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values. Integers are ...
, and only the least-significant byte of b is used. For example, HI_NIBBLE(0xAB)

0xA
and LO_NIBBLE(0xAB)

0xB
. In
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ''ANSI INCITS 226-1994 (S20018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived fro ...
: (defun hi-nibble (b) (ldb (byte 4 4) b)) (defun lo-nibble (b) (ldb (byte 4 0) b))


See also

*
Binary numeral system A binary number is a number expressed in the base-2 numeral system or binary numeral system, a method of mathematical expression which uses only two symbols: typically "0" (zero) and "1" ( one). The base-2 numeral system is a positional notatio ...
*
Syllable (computing) In computing, a syllable is a name for a platform-dependent unit of information storage. Depending on the target hardware, various bit widths (and sometimes internal groupings) are associated with it. Commonly used in the 1960s and 1970s, the term ...
*
Word A word is a basic element of language that carries an semantics, objective or pragmatics, practical semantics, meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of w ...


References


External links

* {{Computer Storage Volumes Computing terminology Data unit Units of information Articles with example C code